package com.education.ai.context;

import com.education.ai.entity.Teacher;

/**
 * 教师上下文类
 * 用于在线程范围内存储当前教师信息
 */
public class TeacherContext {
    
    // 使用ThreadLocal存储当前线程的教师信息
    private static final ThreadLocal<Teacher> CURRENT_TEACHER = new ThreadLocal<>();
    
    /**
     * 设置当前教师
     *
     * @param teacher 教师信息
     */
    public static void setCurrentTeacher(Teacher teacher) {
        CURRENT_TEACHER.set(teacher);
    }
    
    /**
     * 获取当前教师
     *
     * @return 当前教师
     */
    public static Teacher getCurrentTeacher() {
        return CURRENT_TEACHER.get();
    }
    
    /**
     * 清除当前教师信息
     */
    public static void clear() {
        CURRENT_TEACHER.remove();
    }
} 